
#if !defined(AFX_CUSTOMMSGCENTER_H__2012__INCLUDED_)
#define AFX_CUSTOMMSGCENTER_H__2012__INCLUDED_

#include <vector>

class CCustMsgBase
{
};

typedef void (CCustMsgBase::*MSG_PROCESS_FUNC)(WPARAM wParam, LPARAM lParam);
typedef struct _tagMsgProcessFunc
{
	DWORD						dwMsg;
	DWORD						dwTimerID;
	CCustMsgBase*				pThis;
	MSG_PROCESS_FUNC			pFunc;
}MSGPROCESSFUNC;
typedef std::vector<MSGPROCESSFUNC> VECREGMSGFUNC;


#define MSG_TEXT_BUF_COUNT			10

class CCustomMsgCenter
{
public:
	CCustomMsgCenter();
	~CCustomMsgCenter();

	BOOL							Init();
	BOOL							Uninit();

	BOOL							RegTimerProcess(	DWORD dwTimerID,	CCustMsgBase* pThis,	MSG_PROCESS_FUNC pMsgProc);
	BOOL							RemoveTimerProcess(	DWORD dwTimerID,	CCustMsgBase* pThis,	MSG_PROCESS_FUNC pMsgProc);

	BOOL							RegCustomMsgProcess(	DWORD dwMsg,	CCustMsgBase* pThis,	MSG_PROCESS_FUNC pMsgProc);
	BOOL							RemoveCustomMsgProcess(	DWORD dwMsg,	CCustMsgBase* pThis,	MSG_PROCESS_FUNC pMsgProc);

	BOOL							StartTimer(DWORD dwTimerID, DWORD dwElapse);
	BOOL							StopTimer(DWORD dwTimerID);

	BOOL							PostCustMessage(DWORD dwMsg, WPARAM wParam, LPARAM lParam);
	BOOL							SendCustMessage(DWORD dwMsg, WPARAM wParam, LPARAM lParam);
	BOOL							PostStringMessage(DWORD dwMsg, CString strMsgText, LPARAM lParam);

private:
	static	LRESULT __cdecl			MessageWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam/*,BOOL& bHandled*/);

private:
	VECREGMSGFUNC					m_vecMsgFunc;
	
	HWND							m_hMessageWnd;
	WNDPROC							m_oldMsgProc;

	int								m_nCurBlankMsgText;
	TCHAR							m_szMsgTextBuf[MSG_TEXT_BUF_COUNT][MAX_PATH];
};


#endif//AFX_CUSTOMMSGCENTER_H__2012__INCLUDED_